import { App, reactive } from 'vue'
export const $g = reactive({
  title: '中后台管理系统',
  regExp: {
    phone: /^1[3456789]\d{9}$/,
    url: /^((https|http|ftp|rtsp|mms)?:\/\/)(([0-9A-Za-z_!~*'().&=+$%-]+: )?[0-9A-Za-z_!~*'().&=+$%-]+@)?(([0-9]{1,3}.){3}[0-9]{1,3}|([0-9A-Za-z_!~*'()-]+.)*([0-9A-Za-z][0-9A-Za-z-]{0,61})?[0-9A-Za-z].[A-Za-z]{2,6})(:[0-9]{1,4})?((\/?)|(\/[0-9A-Za-z_!~*'().;?:@&=+$,%#-]+)+\/?)$/,
    password: /^[A-Za-z0-9~!@#$%^&*()_+=\-.,]{6,32}$/,
    username: /^[a-zA-Z]{1}([a-zA-Z0-9]|[_]){3,15}$/,
    email: /^[A-Za-z0-9\u4e00-\u9fa5]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/
  },
  caches: {
    storages: {
      user: 'user-info',
      collapsed: 'layout-menu-collapsed',
      selectedKeys: 'layout-menu-selectedkeys',
      opens: 'layout-menu-opens',
      breadcrumbs: 'layout-breadcrumbs',
      routes: 'history-routes'
    }
  },
  menus: {
    active: [],
    selectedKeys: [],
    items: []
  },
  breadcrumbs: [] // 面包屑菜单栏
})

const global = {
  install(app: App) {
    app.config.globalProperties.$g = $g
    return app
  }
}
export default global